#include "Log.h"


Log::Log(void)
	:Component(COMP_LOG)
{
	m_dumpFile.open("./log/log.txt",ofstream::out|ofstream::trunc);
	if(!m_dumpFile.is_open())
	{
		EXCEPTION("Dump file can not open")
	}
}


Log::~Log(void)
{
	m_dumpFile.close();
}


void Log::AddedToObject()
{
	RequestMessage(MSG_LOG,&Log::DumpMessage);
}

void Log::DumpMessage(const Message& msg)
{
	string str;
	AuxUnGroupArgus(msg.p,str);
	m_dumpFile<<str<<endl;
}